<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/UpLoadClass.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../common/admin.asp"-->
<%
dim nTime : nTime = Timer()
dim myrequest,lngUpSize
Set myrequest=new UpLoadClass
    myrequest.Charset="UTF-8"
	myrequest.TotalSize= 10485760
	myrequest.MaxSize  = 5000*1024
	myrequest.FileType = "gif/jpg/png"
	myrequest.Savepath = "/upload/"
lngUpSize = myrequest.Open()
'response.Write myrequest.Form("brandlogo_Size") 图片大小
'response.Write myrequest.Form("brandlogo_Width") 图片宽度
'response.Write myrequest.Form("brandlogo_Height") 图片高度



	if myrequest.Form("t")="add" then
		url=checkstr(inHTML(myrequest.Form("url")))
		title=checkstr(inHTML(myrequest.Form("title")))
		pic=checkstr(inHTML(myrequest.Form("pic")))
		qty=checkstr(inHTML(myrequest.Form("qty")))
		content=checkstr(inHTML(myrequest.Form("content")))
		id=checkstr(inHTML(myrequest.Form("id")))
		uid=checkstr(inHTML(myrequest.Form("uid")))
		back=checkstr(inHTML(myrequest.Form("back")))
	
		
		if url="" and title="" and pic="" or uid="" then
		response.write"<script>alert('商品链接、商品名称、商品图片不能全部为空');</script>"
		response.write"<script>window.history.back(-1);</script>"
		response.end
		end if
		
		if qty="" then
		response.write"<script>alert('数量不能为空');</script>"
		response.write"<script>window.history.back(-1);</script>"
		response.end
		end if

		set rsx=server.createobject("adodb.recordset")
		if id<>"" then
			sql="select * from InquiryCart where id="&id&""
			rsx.open sql,conn,1,3
		else
		    sql="select * from InquiryCart"
			rsx.open sql,conn,1,3
			rsx.addnew
		end if
		rsx("uid")=uid
		rsx("url")=url
		rsx("title")=title
		if pic<>"" then rsx("pic")=myrequest.Savepath&pic
		rsx("qty")=qty
		rsx("content")=content
		rsx("adminname")=request.cookies("admin")("name")
		rsx.update
		rsx.close
		set rsx=nothing
		
		response.write"<script language=JavaScript>{window.alert('加入成功');window.location.href='"&back&"';}</script>"
	end if	
%>